package com.yanze.controller;

import com.yanze.pojo.Homebanner;
import com.yanze.service.HomeService;
import com.yanze.utils.BaseJSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("home")
public class HomeMenuController {

    @Autowired
    private HomeService mHomeService;

    @RequestMapping(path = "/getHomeBanner",method = RequestMethod.GET)
    public BaseJSONResult getHomeMenu() {
        List<Homebanner> banners = mHomeService.getHomeBanner();
        if (banners == null || banners.isEmpty()) {
            return BaseJSONResult.errorMsg("查询错误");
        }
        return BaseJSONResult.ok(banners);
    }
}
